unit models;

{*
Common higher code for models
}

interface

uses SysUtils, Classes, gl, md3s, vectors, glSoarMain, VUMaths;

type
  TModel = class
    BaseModel : TMd3ModelDynamic;
    Position : TVector3D;
    Rotation : TVector3D;
    Speed : real;
    Scale : real;

    procedure Draw(ATime : glFloat); virtual; 
    // function CreatePart(...) <-- this will add it to some list too, maybe so I can set IDLE for all part at once or so, or maybe create abstract method Idle and implement it differently in descendants
  end;
  
implementation

procedure TModel.Draw(ATime : glFloat);
{*
Draw entire model
}
begin
  glPushMatrix;
    glDisable(GL_TEXTURE_GEN_S);
    glDisable(GL_TEXTURE_GEN_T);
    glTranslateF(Position.X, Position.Y, Position.Z);
    glRotatef(Rotation.X,1.0,0.0,0.0);
    glRotatef(Rotation.Y,0.0,1.0,0.0);
    glRotatef(Rotation.Z,0.0,0.0,1.0);
    glScalef(Scale,Scale,Scale);
    glMultMatrixf(@BaseModel.BaseMatrix);
    BaseModel.DrawLinked(BaseModel,ATime);
  glPopMatrix;
end;

end.